import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const addGood = r => require.ensure([], () => r(require('@/page/addGood')), 'addGood');
const addEquip = r => require.ensure([], () => r(require('@/page/addEquip')), 'addEquip');
const userList = r => require.ensure([], () => r(require('@/page/userList')), 'userList');
const equipList = r => require.ensure([], () => r(require('@/page/equipList')), 'equipList');
const goodList = r => require.ensure([], () => r(require('@/page/goodList')), 'goodList');
const orderList = r => require.ensure([], () => r(require('@/page/orderList')), 'orderList');
const install = r => require.ensure([], () => r(require('@/page/install')), 'install');
const visitor = r => require.ensure([], () => r(require('@/page/visitor')), 'visitor');
const newMember = r => require.ensure([], () => r(require('@/page/newMember')), 'newMember');
const uploadImg = r => require.ensure([], () => r(require('@/page/uploadImg')), 'uploadImg');
const vueEdit = r => require.ensure([], () => r(require('@/page/vueEdit')), 'vueEdit');
const adminSet = r => require.ensure([], () => r(require('@/page/adminSet')), 'adminSet');
const sendMessage = r => require.ensure([], () => r(require('@/page/sendMessage')), 'sendMessage');
const explain = r => require.ensure([], () => r(require('@/page/explain')), 'explain');
const comment = r => require.ensure([], () => r(require('@/page/comment')), 'comment');
const callcenter = r => require.ensure([], () => r(require('@/page/callcenter')), 'callcenter');

const routes = [
	{
		path: '/',
		component: login
	},
	{
		path: '/manage',
		component: manage,
		name: '',
		children: [{
			path: '',
			component: home,
			meta: [],
		},
            {
			path: '/addGood',
			component: addGood,
			meta: ['商品列表', '添加商品'],
		},
            {
			path: '/addEquip',
			component: addEquip,
			meta: ['设备列表', '添加设备'],
		},{
			path: '/userList',
			component: userList,
			meta: ['用户管理', '用户列表'],
		},{
			path: '/equipList',
			component: equipList,
			meta: ['商品', '设备列表'],
		},
            {
			path: '/goodList',
			component: goodList,
			meta: ['商品', '商品列表'],
		},
            {
                path: '/callcenter',
                component: callcenter,
                meta: ['客服中心', '客服'],
            },
            {
			path: '/orderList',
			component: orderList,
			meta: ['订单管理', '订单列表'],
		},{
			path: '/install',
			component: install,
			meta: ['订单管理', '安装列表'],
		},{
			path: '/visitor',
			component: visitor,
			meta: ['图表', '用户分布'],
		},{
			path: '/newMember',
			component: newMember,
			meta: ['图表', '用户数据'],
		},
            {
                path: '/deleteComment',
                component: comment,
                meta: ['评论', '评论管理'],

            },{
			path: '/uploadImg',
			component: uploadImg,
			meta: ['文本编辑', 'MarkDown'],
		},{
			path: '/vueEdit',
			component: vueEdit,
			meta: ['编辑管理', '文本编辑'],
		},{
			path: '/adminSet',
			component: adminSet,
			meta: ['设置', '管理员设置'],
		},{
			path: '/sendMessage',
			component: sendMessage,
			meta: ['设置', '发送通知'],
		},{
			path: '/explain',
			component: explain,
			meta: ['说明', '说明'],
		}]
	}
]

export default new Router({
	routes,
})
